import 'package:flutter/material.dart';
import 'package:flutter_juwo/common/common_index.dart';
import 'package:flutter_juwo/ui/model/member_entity.dart';

class General extends StatefulWidget {
  final MemberDataViplist data;

  General(this.data);

  @override
  _GeneralState createState() => _GeneralState();
}

class _GeneralState extends State<General> {
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        shrinkWrap: true,
        physics:NeverScrollableScrollPhysics(),
        itemCount: widget.data.child.length,
        itemBuilder: (BuildContext context, int index) {
          return this.getItem(widget.data.child[index]);
        });
  }

  Widget getItem(MemberDataViplistChild child) {
    return Container(
      child: Row(
        children: <Widget>[
          Container(
            height: ScreenUtil().setWidth(120),
            width: ScreenUtil().setWidth(120),
            child: ClipOval(
              child: UiUtils.cachedNetworkImage(120, 120, child.icon),
            ),
          ),
          Container(
            height: ScreenUtil().setWidth(120),
            margin: EdgeInsets.only(
                top: ScreenUtil().setWidth(20),
                bottom: ScreenUtil().setWidth(20),
                left: ScreenUtil().setWidth(30),
                right: ScreenUtil().setWidth(30)),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                Container(
                  child: Text(
                    "${child.label}",
                    style: TextStyles.custom(
                        30, Colours.appC1, Font.PingFangBlod),
                  ),
                ),
                Container(
                  width: ScreenUtil().setWidth(500),
                  child: Text(
                    "${child.desc}",
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyles.custom(
                        26, Colours.appC2, Font.PingFangMedium),
                  ),
                ),
                Container(
                  width: ScreenUtil().setWidth(500),
                  height: ScreenUtil().setWidth(1),
                  color: Colours.c243,
                ),
              ],
            ),
          )
        ],
      ),
    );
  }
}
